﻿<Window
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:converters="clr-namespace:UMLSynthesizer.Tasks.View.Converters"
	x:Class="UMLSynthesizer.Tasks.View.ClassDiagramControlPanelWindow"
	x:Name="Window"
	Title="Class Diagram Control Panel"
	Width="600" Height="460" MinWidth="600" MinHeight="460">
    <Window.Resources>
        <converters:BoolInverterConverter x:Key="BoolInverterConverter" />
        <converters:MetricNamesConverter x:Key="MetricNames" />
    </Window.Resources>

    <Grid x:Name="LayoutRoot">
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition Width="220"/>
        </Grid.ColumnDefinitions>
        <Label Content="Package to show:" HorizontalAlignment="Left" Margin="10,3,0,0" VerticalAlignment="Top" Height="26" Width="102"/>
        <TreeView Margin="10,29,0,10" ItemsSource="{Binding RootPackages}">
            <TreeView.ItemContainerStyle>
                <Style TargetType="{x:Type TreeViewItem}">
                    <Setter Property="IsSelected" Value="{Binding IsSelected}" />
                </Style>
            </TreeView.ItemContainerStyle>

            <TreeView.ItemTemplate>
                <HierarchicalDataTemplate
                    ItemsSource="{Binding ChildElements}">
                    <StackPanel Orientation="Horizontal">
                        <Image Width="20" Height="20" Margin="3,0" Source="{Binding ImageUri}" />
                        <TextBlock Text="{Binding Identifier}" />
                    </StackPanel>
                </HierarchicalDataTemplate>
            </TreeView.ItemTemplate>
        </TreeView>
        <GroupBox Grid.Column="1" Header="Show" HorizontalAlignment="Left" Margin="10,29,0,0" VerticalAlignment="Top" >
            <StackPanel>
                <CheckBox Content="Classes" IsChecked="{Binding ShowContainedClasses}"/>
                <StackPanel Margin="20,0,0,0">
                    <CheckBox Content="Attributes and Methods" IsChecked="{Binding ShowClassMembers}" IsEnabled="{Binding ShowContainedClasses}"/>
                    <StackPanel Margin="20,0,0,0">
                        <CheckBox Content="Explicit types" IsChecked="{Binding ShowClassTypes}" IsEnabled="{Binding ShowClassMembers}"/>
                        <CheckBox Content="Methods parameters" IsChecked="{Binding ShowClassMethodParameters}" IsEnabled="{Binding ShowClassMembers}"/>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <CheckBox Content="Metric" VerticalAlignment="Center" IsChecked="{Binding ShowClassMetrics}" IsEnabled="{Binding ShowContainedClasses}"/>
                        <ComboBox VerticalAlignment="Center" Width="100" Margin="10,0,0,0" IsEnabled="{Binding ShowClassMetrics}" ItemsSource="{Binding AvailableClassMetrics, Converter={StaticResource MetricNames}}" SelectedItem="{Binding SelectedClassMetric, Converter={StaticResource MetricNames}}" />
                    </StackPanel>
                </StackPanel>
                <CheckBox Content="Interfaces" IsChecked="{Binding ShowContainedInterfaces}"/>
                <StackPanel Margin="20,0,0,0">
                    <CheckBox Content="Methods" IsChecked="{Binding ShowInterfaceMembers}" IsEnabled="{Binding ShowContainedInterfaces}"/>
                    <StackPanel Margin="20,0,0,0">
                        <CheckBox Content="Explicit types" IsChecked="{Binding ShowInterfaceTypes}" IsEnabled="{Binding ShowInterfaceMembers}"/>
                        <CheckBox Content="Methods parameters" IsChecked="{Binding ShowInterfaceMethodParameters}" IsEnabled="{Binding ShowInterfaceMembers}"/>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <CheckBox Content="Metric" VerticalAlignment="Center" IsChecked="{Binding ShowInterfaceMetrics}" IsEnabled="{Binding ShowContainedInterfaces}"/>
                        <ComboBox VerticalAlignment="Center" Width="100" Margin="10,0,0,0" IsEnabled="{Binding ShowInterfaceMetrics}" ItemsSource="{Binding AvailableInterfaceMetrics, Converter={StaticResource MetricNames}}" SelectedItem="{Binding SelectedInterfaceMetric, Converter={StaticResource MetricNames}}" />
                    </StackPanel>
                </StackPanel>
                <CheckBox Content="Packages" IsChecked="{Binding ShowContainedPackages}"/>
                <StackPanel Margin="20,0,0,0">
                    <StackPanel Orientation="Horizontal">
                        <CheckBox VerticalAlignment="Center" Content="Metric" IsChecked="{Binding ShowPackageMetrics}"/>
                        <ComboBox VerticalAlignment="Center" IsEnabled="{Binding ShowPackageMetrics}" ItemsSource="{Binding AvailablePackageMetrics, Converter={StaticResource MetricNames}}" Margin="10,0,0,0" Width="100" SelectedItem="{Binding SelectedPackageMetric, Converter={StaticResource MetricNames}}" />
                    </StackPanel>
                </StackPanel>
                <CheckBox Content="Structs" IsChecked="{Binding ShowContainedStructs}"/>
                <StackPanel Margin="20,0,0,0">
                    <CheckBox Content="Attributes and Methods" IsChecked="{Binding ShowStructMembers}" IsEnabled="{Binding ShowContainedStructs}"/>
                    <StackPanel Margin="20,0,0,0">
                        <CheckBox Content="Explicit types" IsChecked="{Binding ShowStructTypes}" IsEnabled="{Binding ShowStructMembers}"/>
                        <CheckBox Content="Methods parameters" IsChecked="{Binding ShowStructMethodParameters}" IsEnabled="{Binding ShowStructMembers}"/>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <CheckBox Content="Metric" VerticalAlignment="Center" IsChecked="{Binding ShowStructMetrics}" IsEnabled="{Binding ShowContainedStructs}"/>
                        <ComboBox VerticalAlignment="Center" Width="100" Margin="10,0,0,0" IsEnabled="{Binding ShowStructMetrics}" ItemsSource="{Binding AvailableStructMetrics, Converter={StaticResource MetricNames}}" SelectedItem="{Binding SelectedStructMetric, Converter={StaticResource MetricNames}}" />
                    </StackPanel>
                </StackPanel>
                <CheckBox Content="External dependencies" IsChecked="{Binding ShowExternalDependencies}" />
                <StackPanel Margin="20,0,0,0">
                    <CheckBox Content="Primitive types" IsEnabled="{Binding ShowExternalDependencies}" IsChecked="{Binding ShowPrimitiveTypes}" />
                </StackPanel>
            </StackPanel>
        </GroupBox>
        <CheckBox Content="Enable automatic refresh" Grid.Column="1" HorizontalAlignment="Left" Margin="10,370,0,0" VerticalAlignment="Top" IsChecked="{Binding IsAutomaticRefreshEnabled}" Height="15" Width="151"/>
        <Button Content="Refresh" Grid.Column="1" HorizontalAlignment="Left" Margin="10,390,0,0" VerticalAlignment="Top" Width="75" IsEnabled="{Binding IsAutomaticRefreshEnabled, Converter={StaticResource BoolInverterConverter}}" Command="{Binding RefreshCommand}" Height="20"/>
    </Grid>
</Window>